package com.yitao.client.constant;

import com.yitao.client.constant.OrderStatusEmnu;

import java.util.HashMap;
import java.util.Map;

/**
 * Function:
 * Date: 2019/1/4
 *
 * @author skipper
 * @desc
 * @see
 */
public abstract class PayEnum {

    /**
     * 业务类型 1:商城业务 2:采购业务
     */
    public enum BUSINESS_TYPE_ENUM {
        MALL(1),
        PROCUREMENT(2);

        private Integer code;


        BUSINESS_TYPE_ENUM(Integer code) {
            this.code = code;

        }

        public Integer getCode() {
            return code;
        }

    }

    /**
     * 支付平台类型 1:微信支付 2:支付宝,3:连连,4汇付微信，5汇付快捷支付 6 联动微信 ,7联动快捷,8线下
     */
    public enum PAY_CLIENT_TYPE {
        WE_CHAT(1),
        ALI_PAY_YIN(2),
        LL_PAY(3),
        HF_WE_CHAT(4),
        HF_CARD_PAY(5),
        UMF_WE_CHAT(6),
        UMF_CARD_PAY(7),
        OFFLINE_PAY(8);

        private Integer code;


        PAY_CLIENT_TYPE(Integer code) {
            this.code = code;

        }

        public Integer getCode() {
            return code;
        }

    }

    /**
     * 支付类型 1:用户付款 2:商户付款,3:用户退款 4:商户退款
     */
    public enum PAY_TYPE_ENUM {
        USER_PAY(1),
        BUSINESS_PAY(2),
        USER_REFUND(3),
        BUSINESS_REFUND(4);

        private Integer code;


        PAY_TYPE_ENUM(Integer code) {
            this.code = code;

        }

        public Integer getCode() {
            return code;
        }
    }

    /**
     * 支付交易类型 如 APP,H5,扫码支付
     */
    public enum TRADE_TYPE {
        APP_PAY("1"),
        H5_PAY("2"),
        SCAN_QR_PAY("3");

        private String code;


        TRADE_TYPE(String code) {
            this.code = code;

        }

        public String getCode() {
            return code;
        }
    }


    /**
     * 支付平台类型 1:微信支付 2:支付宝,3:银联
     */
    public enum PayClientShowTypeEnum {
        WE_CHAT(PAY_CLIENT_TYPE.WE_CHAT.code, "微信支付"),
        ALI_PAY_YIN(PAY_CLIENT_TYPE.ALI_PAY_YIN.getCode(), "支付宝"),
        UNION_PAY(PAY_CLIENT_TYPE.LL_PAY.getCode(), "连连支付"),
        HF_WE_CHAT(PAY_CLIENT_TYPE.HF_WE_CHAT.getCode(), "汇付微信"),
        HF_CARD_PAY(PAY_CLIENT_TYPE.HF_CARD_PAY.getCode(), "汇付快捷支付"),
        UMF_WE_CHAT(PAY_CLIENT_TYPE.UMF_WE_CHAT.getCode(), "联动微信"),
        UMF_CARD_PAY(PAY_CLIENT_TYPE.UMF_CARD_PAY.getCode(), "联动快捷支付"),
        OFFLINE_PAY(PAY_CLIENT_TYPE.OFFLINE_PAY.getCode(), "线下支付");

        private static final Map<Integer, PayClientShowTypeEnum> map = new HashMap<>();

        static {
            PayClientShowTypeEnum[] values = PayClientShowTypeEnum.values();
            for (PayClientShowTypeEnum item : values) {
                map.put(item.code, item);
            }
        }

        private final Integer code;
        private final String name;

        private PayClientShowTypeEnum(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public static PayClientShowTypeEnum getEnum(Integer code) {
            return map.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }


    /**
     * 支付状态 0:未付款 1:已付款 2:已退款 3 未退款
     */
    public enum PayStatus {
        NON_PAYMENT(OrderStatusEmnu.PAY_STATUS.NOT_PAY.getCode(), "未付款"),
        PAID(OrderStatusEmnu.PAY_STATUS.HAVE_PAY.getCode(), "已付款"),
        REFUNDED(OrderStatusEmnu.PAY_STATUS.REFUND.getCode(), "已退款"),
        NOT_REFUND(OrderStatusEmnu.PAY_STATUS.NOT_REFUND.getCode(), "未退款");

        private static final Map<Integer, PayStatus> map = new HashMap<>();

        static {
            PayStatus[] values = PayStatus.values();
            for (PayStatus item : values) {
                map.put(item.code, item);
            }
        }

        private final Integer code;
        private final String name;

        private PayStatus(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public static PayStatus getEnum(Integer code) {
            return map.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }


}
